package com.org.beauty.salon.controller;


import com.org.beauty.salon.dto.UserUpdateDto;
import com.org.beauty.salon.entity.SysUser;
import com.org.beauty.salon.model.ResponseData;
import com.org.beauty.salon.model.SuccessResponseData;
import com.org.beauty.salon.service.ISysUserService;
import com.org.beauty.salon.utils.CopyUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 管理员表 前端控制器
 * </p>
 *
 * @author zhangyanbin
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/salon/sys-user")
public class SysUserController {

    @Autowired
    private ISysUserService userService;

    @ApiOperation(value = "管理员修改", notes = "修改接口")
    @RequestMapping(value = "update", method = RequestMethod.POST)
    public ResponseData updateByCondition(UserUpdateDto userUpdateDto){
        SysUser sysUser = CopyUtil.copy(userUpdateDto, SysUser.class);
        boolean result = userService.updateById(sysUser);
        return new SuccessResponseData(result);
    }

}
